Let's first check the Python version you have installed on your machine. Remember, to run the examples, it must be 2.7.X


In [1]:
import sys
print "Your Python version is", sys.version


Your Python version is 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2]

Now let's check if you have all the necessary toolkits installed and working properly:


In [2]:
errors = 0

In [3]:
try:
    import numpy as np
    print "Numpy installed, version", np.__version__
except ImportError:
    print "Numpy is not installed!"
    errors += 1


Numpy installed, version 1.10.1

In [4]:
try:
    import scipy
    print "Scipy installed, version", scipy.__version__
except ImportError:
    print "Scipy is not installed!"
    errors += 1


Scipy installed, version 0.18.0

In [5]:
try:
    import matplotlib
    print "Matplotlib installed, version", matplotlib.__version__
except ImportError:
    print "Matplotlib is not installed!"
    errors += 1


Matplotlib installed, version 1.5.1

In [6]:
try:
    import sklearn
    print "Sklearn installed, version", sklearn.__version__
except ImportError:
    print "Sklearn is not installed!"
    errors += 1


Sklearn installed, version 0.17

In [7]:
try:
    import networkx
    print "Networkx installed, version", networkx.__version__
except ImportError:
    print "Networkx is not installed!"
    errors += 1


Networkx installed, version 1.11

In [8]:
try:
    import nltk
    print "Nltk installed, version", nltk.__version__
except ImportError:
    print "Nltk is not installed!"
    errors += 1


Nltk installed, version 3.2.1

Here''s the verdict:


In [9]:
if errors == 0:
    print "Your machine can run the code"
else:
    print "We found", errors, "errors. Please check them and install the missing toolkits"


Your machine can run the code